<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
    <title>首页</title>
    <div th:replace="~{fragments/head-base}"></div>
</head>
<body class="body sidebar-left-hidden fixedNav_position fixedMenu_left">
<div class="preloader" style=" position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 100000;
  backface-visibility: hidden;
  background: #ffffff;">
    <div class="preloader_img" style="width: 200px;
  height: 200px;
  position: absolute;
  left: 48%;
  top: 48%;
  background-position: center;
z-index: 999999">
        <img th:src="@{/img/loader.gif}" style=" width: 50px;" alt="loading...">
    </div>
</div>
<!--wrap-->
<div id="wrap">
    <div th:replace="~{fragments/top :: top}"></div>
    <!-- /#top -->
    <div class="wrapper fixedNav_top">
        <div th:replace="~{fragments/left :: left}"></div>
        <!-- /#left -->
        <div id="content" class="bg-container">
            <header class="head">
                <div class="main-bar">
                    <div class="row no-gutters">
                        <div class="col-6">
                            <h4 class="m-t-5">
                                <i class="fa fa-home"></i><span class="ml-1">首页</span>
                            </h4>
                        </div>
                    </div>
                </div>
            </header>

            <div class="outer">
                <div class="inner bg-container">
                    <div class="row">
                        <div class="col-12">
                            <h4>
                                在这里，享受Coding的欢乐！
                            </h4>
                        </div>
                    </div>
                    <div class="row mt-3">
                        <!--轮播图-->
                        <div class="col-6">
                            <div id="carouselExampleIndicators" class="carousel slide" data-ride="carousel">
                                <ol class="carousel-indicators">
                                    <li data-target="#carouselExampleIndicators" data-slide-to="0" class="active"></li>
                                    <li data-target="#carouselExampleIndicators" data-slide-to="1"></li>
                                    <li data-target="#carouselExampleIndicators" data-slide-to="2"></li>
                                    <li data-target="#carouselExampleIndicators" data-slide-to="3"></li>
                                </ol>
                                <div class="carousel-inner">
                                    <div class="carousel-item active">
                                        <img class="d-block w-100 h-25" th:src="@{/img/indexImg4.jpg}"
                                             alt="Second slide">
                                    </div>
                                    <div class="carousel-item">
                                        <img class="d-block w-100 h-25" th:src="@{/img/indexImg2.png}"
                                             alt="Third slide">
                                    </div>
                                    <div class="carousel-item">
                                        <img class="d-block w-100 h-25" th:src="@{/img/indexImg3.jpg}"
                                             alt="Third slide">
                                    </div>
                                    <div class="carousel-item">
                                        <img class="d-block w-100 h-25" th:src="@{/img/indexImg1.jpg}"
                                             alt="Third slide">
                                    </div>
                                </div>
                                <a class="carousel-control-prev" href="#carouselExampleIndicators" role="button"
                                   data-slide="prev">
                                    <span class="carousel-control-prev-icon" aria-hidden="true"></span>
                                    <span class="sr-only">Previous</span>
                                </a>
                                <a class="carousel-control-next" href="#carouselExampleIndicators" role="button"
                                   data-slide="next">
                                    <span class="carousel-control-next-icon" aria-hidden="true"></span>
                                    <span class="sr-only">Next</span>
                                </a>
                            </div>
                        </div>
                        <!--#轮播图-->
                        <div class="col-6">
                            <div class="text-center ">
                                <span sec:authorize="isAuthenticated()">
                                    <h3>欢迎回来，<a class="text-primary">[[${#authentication.principal.name}]]</a></h3>
                                </span>
                                <h3 class="text-danger">[[${#dates.format(nowDate,'yyyy')}]]&nbsp;Years</h3>
                                <h3 class="text-success">[[${#dates.format(nowDate,'MM')}]]&nbsp;Month</h3>
                                <h3 class="text-primary">[[${#dates.format(nowDate,'dd')}]]&nbsp;Day</h3>
                                <h4 class="text-warning">今天是一个特殊的日子</h4>
                            </div>
                        </div>
                    </div>
                    <div class="row mt-3">
                        <div class="col-3">
                            <div class="card">
                                <div class="card-block ">
                                    <p><i class="fa fa-paper-plane"></i><span class="ml-1">快速跳转</span></p>
                                    <input type="number" id="problemId" name="problemId"
                                           class="form-control   focused_input" placeholder="例：1048，可跳至“加法”">
                                    <div class="mt-3">
                                        <button onclick="skipProblemDetail()" class="btn btn-danger float-left"
                                                type="submit">跳转
                                        </button>
                                        <button type="button" class="btn btn-primary ml-2 float-left"
                                                onclick="randomProblem()">随机跳题
                                        </button>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-9">
                            <div class="card">
                                <div class="card-block  ">
                                    <div class="row">
                                        <img th:src="@{/img/indexStep1.png}" class="col-4">
                                        <img th:src="@{/img/indexStep2.png}" class="col-4">
                                        <img th:src="@{/img/indexStep3.png}" class="col-4">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row mt-3">
                        <div class="col-8">
                            <div class="card">
                                <div class="card-header bg-white">
                                    <i class="fa fa fa-trophy"></i>近期题目集
                                </div>
                                <div class="card-block">
                                    <div class="row">
                                        <div class="col-4" th:each="competition,status:${competitionList}">
                                            <div th:classappend="${status.index + 1 > 3} ? 'card-outline-warning mt-3' : 'card-outline-success'"
                                                 class="card ">
                                                <div th:classappend="${status.index + 1 > 3} ? 'bg-warning' : 'bg-success'"
                                                     class="card-header  ">
                                                    <a class="text-white"
                                                       th:href="@{'/competition/competitionDetailPage?compId='+${competition.id}}">[[${competition.competitionName}]]</a>
                                                </div>
                                                <div class="card-block">
                                                    <div>
                                                        <div class="">
                                                            <span th:if="${competition.secret}"
                                                                  class="btn btn-primary btn-sm">公开赛&nbsp;</span>
                                                            <span th:if="!${competition.secret}"
                                                                  class=" btn-primary btn-sm">私密赛&nbsp;</span>
                                                            <span class="ml-3">
                                                                <span class="text-success"
                                                                      th:if="${competition.competitionStatus == 1 }">未开始</span>
                                                                <span class="text-warning"
                                                                      th:if="${competition.competitionStatus == 2 }">进行中</span>
                                                                <span class="text-danger"
                                                                      th:if="${competition.competitionStatus == 3 }">已结束</span>
                                                            </span>
                                                            <span class=" float-right  gray-font">
                                                            [[${#dates.format(competition.startTime,'yyyy-M-d HH:mm')}]]
                                                            </span>
                                                        </div>
                                                        <div class="mt-2">
                                                            <span class=" btn-warning btn-sm">OI赛制</span>&nbsp;
                                                            <a class="text-danger ml-3"
                                                               th:href="@{'/user/mainPage?userId='+${competition.userId}}">[[${competition.name}]]</a>
                                                            <span class="gray-font  float-right">[[${#dates.format(competition.endTime,'yyyy-M-d HH:mm')}]]</span>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-4">
                            <div class="card">
                                <div class="card-header bg-white">
                                    <i class="fa fa-bullhorn"></i><span class="ml-1">本站公告</span>
                                </div>
                                <div class="card-block">
                                    <div class="row">
                                        <div class="col-12">
                                            <div th:each="noticeBlog,status : ${noticeBlogList}">
                                                <a class="primary-hover"
                                                   th:href="@{'/blog/blogDetailPage?blogId='+${noticeBlog.id}}">
                                                    <div>[[${noticeBlog.title}]]</div>
                                                </a>
                                                <div class="mt-1">
                                                    <span class="gray-font ">发表于：[[${#dates.format(noticeBlog.createTime,'yyyy-MM-dd HH:mm:ss')}]]</span>
                                                    <span class="gray-font  float-right">浏览&nbsp;[[${noticeBlog.viewCount}]]</span>
                                                </div>
                                                <hr th:if="${status.count != status.size}" class="mt-3"/>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div class="row mt-3">
                        <div class="col-8">
                            <div class="card">
                                <div class="card-header bg-white">
                                    <i class="fa fa-comments"></i>最新讨论
                                </div>
                                <div class="card-block ">
                                    <div class="row">
                                        <div th:classappend="${status.index + 1 > 3} ? 'mt-3':''" class="col-4"
                                             th:each="lastBlog,status:${lastBlogList}">
                                            <div class="card card-outline-primary">
                                                <div class="card-block">
                                                    <div class="row">
                                                        <div>
                                                            <a target="_blank"
                                                               th:href="@{'/user/mainPage?userId='+${lastBlog.userId}}">
                                                                <img class=" img-50  float-left rounded-circle"
                                                                     th:src="${lastBlog.avatar==null}?'img/default_avatar.jpg':${lastBlog.avatar}">
                                                            </a>
                                                        </div>
                                                        <div class="ml-3">
                                                            <div><a target="_blank"
                                                                    th:href="@{'/blog/blogDetailPage?blogId='+${lastBlog.id}}"
                                                                    class="text-primary">[[${lastBlog.title}]]</a>
                                                            </div>
                                                            <div class="font-size14">
                                                                <div class="mt-1">
                                                                    <a target="_blank"
                                                                       th:href="@{'/user/mainPage?userId='+${lastBlog.userId}}"
                                                                       class="text-danger mr-1">[[${lastBlog.name}]]</a>
                                                                    <span class="gray-font">In</span>
                                                                    <a th:href="@{'/blog/blogListPage?bcId='+${lastBlog.bcId}}"
                                                                       class="ml-1 primary-hover" target="_blank"
                                                                       th:text="${'['+lastBlog.bcName+']'}"></a>
                                                                </div>

                                                                <div class="mt-1 gray-font">
                                                                    @[[${#dates.format(lastBlog.replyTime,'yyyy-MM-dd
                                                                    HH:mm:ss')}]]回复
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-4">

                            <div class="card">
                                <div class="card-header bg-white">
                                    <i class="fa fa-user"></i><span class="ml-1">友情链接</span>
                                </div>
                                <div class="card-block ">
                                    <p>
                                    <a target="_blank" href="https://www.jisuanke.com/" class="text-primary">计蒜客 - 学习面向未来的计算机科学</a>
                                    </p>
                                    <p>
                                    <a target="_blank" href="https://leetcode.com" class="text-primary">LeetCode - 全球极客挚爱的技术成长平台</a>
                                    </p>
                                </div>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
        <!-- /.inner -->
    </div>
    <!-- /.outer -->
    <!-- /#content -->
    <!-- Modal -->
    <div class="modal fade" id="search_modal" tabindex="-1" role="dialog" aria-hidden="true">
        <form th:action="@{/problem/problemListPage}" method="post">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span class="float-right" aria-hidden="true">&times;</span>
                    </button>
                    <div class="input-group search_bar_small">
                        <input type="text" class="form-control" placeholder="题目搜索" name="keyword">
                        <span class="input-group-btn">
                          <button class="btn btn-secondary" type="submit"><i class="fa fa-search"></i></button>
                        </span>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <!-- /#content -->
    <!-- # right side -->
</div>
<!-- /#wrap -->
<!-- global scripts-->
<div th:replace="~{fragments/footer :: footer}"></div>
<!--end of global scripts-->
<!--  plugin scripts -->
<script type="text/javascript" th:src="@{/js/pages/index.js}"></script>
<!--end of plugin scripts-->
<script type="text/javascript" th:inline="javascript">


</script>
</body>

</html>
